// 模拟数据API服务
// 这个文件提供模拟数据，让前端可以独立运行和测试
// 当后端API准备好后，可以删除这个文件，直接使用真实的API

// 模拟用户数据
export const mockUsers = [
  {
    id: 1,
    username: 'admin',
    realName: '张三',
    roleId: 1,
    roleName: '部长',
    roleCode: 'minister',
    email: 'admin@example.com',
    phone: '13800138001',
    status: 1
  },
  {
    id: 2,
    username: 'leader1',
    realName: '李四',
    roleId: 2,
    roleName: '项目负责人',
    roleCode: 'project_leader',
    email: 'leader1@example.com',
    phone: '13800138002',
    status: 1
  },
  {
    id: 3,
    username: 'frontend1',
    realName: '王五',
    roleId: 4,
    roleName: '前端负责人',
    roleCode: 'front-end_leader',
    email: 'frontend1@example.com',
    phone: '13800138003',
    status: 1
  },
  {
    id: 4,
    username: 'backend1',
    realName: '赵六',
    roleId: 3,
    roleName: '后端负责人',
    roleCode: 'back-end_leader',
    email: 'backend1@example.com',
    phone: '13800138004',
    status: 1
  },
  {
    id: 5,
    username: 'dev1',
    realName: '钱七',
    roleId: 5,
    roleName: '成员（开发者）',
    roleCode: 'developer',
    email: 'dev1@example.com',
    phone: '13800138005',
    status: 1
  }
]

// 模拟项目数据
export const mockProjects = [
  {
    id: 1,
    projectName: '电商管理系统',
    description: '一个完整的电商平台管理系统，包含用户管理、商品管理、订单管理等功能',
    status: 1,
    progress: 75,
    leaderId: 2,
    leaderName: '李四',
    gitUrl: 'https://github.com/example/ecommerce-system',
    startDate: '2024-01-15',
    endDate: '2024-06-30',
    createdBy: 1,
    createdAt: '2024-01-15 10:00:00',
    updatedAt: '2024-03-15 14:30:00'
  },
  {
    id: 2,
    projectName: '在线教育平台',
    description: '提供在线课程学习、考试、证书管理等功能的综合性教育平台',
    status: 1,
    progress: 45,
    leaderId: 3,
    leaderName: '王五',
    gitUrl: 'https://gitee.com/example/education-platform',
    startDate: '2024-02-01',
    endDate: '2024-08-31',
    createdBy: 1,
    createdAt: '2024-02-01 09:00:00',
    updatedAt: '2024-03-15 16:20:00'
  },
  {
    id: 3,
    projectName: '企业OA系统',
    description: '企业内部办公自动化系统，包含工作流、文档管理、考勤等功能',
    status: 3,
    progress: 100,
    leaderId: 4,
    leaderName: '赵六',
    gitUrl: 'https://github.com/example/oa-system',
    startDate: '2023-09-01',
    endDate: '2024-02-28',
    createdBy: 1,
    createdAt: '2023-09-01 14:00:00',
    updatedAt: '2024-02-28 17:00:00'
  },
  {
    id: 4,
    projectName: '移动端APP',
    description: '跨平台移动应用，支持iOS和Android系统',
    status: 0,
    progress: 0,
    leaderId: 2,
    leaderName: '李四',
    gitUrl: null,
    startDate: '2024-04-01',
    endDate: '2024-12-31',
    createdBy: 1,
    createdAt: '2024-03-01 11:00:00',
    updatedAt: '2024-03-01 11:00:00'
  },
  {
    id: 5,
    projectName: '数据分析平台',
    description: '大数据分析平台，提供数据可视化、报表生成、预测分析等功能',
    status: 2,
    progress: 30,
    leaderId: 5,
    leaderName: '钱七',
    gitUrl: 'https://github.com/example/data-analysis',
    startDate: '2024-01-01',
    endDate: '2024-09-30',
    createdBy: 2,
    createdAt: '2024-01-01 08:00:00',
    updatedAt: '2024-03-10 15:45:00'
  }
]

// 模拟项目模块数据
export const mockProjectModules = [
  {
    id: 1,
    projectId: 1,
    moduleName: '用户管理模块',
    description: '用户注册、登录、权限管理等功能',
    moduleType: 2, // 后端
    status: 1,
    leaderId: 4,
    leaderName: '赵六',
    startDate: '2024-01-15',
    endDate: '2024-03-15',
    finishTime: null,
    createdAt: '2024-01-15 10:00:00',
    updatedAt: '2024-03-15 14:30:00'
  },
  {
    id: 2,
    projectId: 1,
    moduleName: '商品管理模块',
    description: '商品信息管理、库存管理、分类管理等功能',
    moduleType: 2, // 后端
    status: 1,
    leaderId: 4,
    leaderName: '赵六',
    startDate: '2024-01-20',
    endDate: '2024-04-20',
    finishTime: null,
    createdAt: '2024-01-20 09:00:00',
    updatedAt: '2024-03-15 14:30:00'
  },
  {
    id: 3,
    projectId: 1,
    moduleName: '前端界面',
    description: '用户端和管理端的Web界面',
    moduleType: 1, // 前端
    status: 1,
    leaderId: 3,
    leaderName: '王五',
    startDate: '2024-02-01',
    endDate: '2024-05-01',
    finishTime: null,
    createdAt: '2024-02-01 14:00:00',
    updatedAt: '2024-03-15 14:30:00'
  }
]

// 模拟项目文档数据
export const mockProjectDocuments = [
  {
    id: 1,
    projectId: 1,
    documentName: 'API接口文档',
    documentType: 1, // API文档
    version: 'v1.0.0',
    content: '详细的API接口说明，包含请求参数、响应格式、错误码等',
    filePath: '/documents/api-doc-v1.0.0.md',
    createdBy: 4,
    creatorName: '赵六',
    createdAt: '2024-01-20 16:00:00',
    updatedAt: '2024-01-20 16:00:00'
  },
  {
    id: 2,
    projectId: 1,
    documentName: '数据库设计文档',
    documentType: 3, // 数据库文档
    version: 'v1.0.0',
    content: '数据库表结构设计、索引设计、关系图等',
    filePath: '/documents/db-design-v1.0.0.md',
    createdBy: 4,
    creatorName: '赵六',
    createdAt: '2024-01-25 10:00:00',
    updatedAt: '2024-01-25 10:00:00'
  },
  {
    id: 3,
    projectId: 1,
    documentName: '前端设计稿',
    documentType: 2, // 设计文档
    version: 'v1.0.0',
    content: 'UI设计稿、交互设计说明、组件规范等',
    filePath: '/documents/ui-design-v1.0.0.sketch',
    createdBy: 3,
    creatorName: '王五',
    createdAt: '2024-02-05 14:00:00',
    updatedAt: '2024-02-05 14:00:00'
  }
]

// 模拟角色数据
export const mockRoles = [
  {
    id: 1,
    roleName: '部长',
    roleCode: 'minister'
  },
  {
    id: 2,
    roleName: '项目负责人',
    roleCode: 'project_leader'
  },
  {
    id: 3,
    roleName: '后端负责人',
    roleCode: 'back-end_leader'
  },
  {
    id: 4,
    roleName: '前端负责人',
    roleCode: 'front-end_leader'
  },
  {
    id: 5,
    roleName: '成员（开发者）',
    roleCode: 'developer'
  }
]

// 模拟API响应
export const createMockResponse = (data, success = true, message = '') => {
  return {
    code: success ? 200 : 500,
    message: message || (success ? '操作成功' : '操作失败'),
    data: data
  }
}

// 模拟延迟
export const mockDelay = (ms = 500) => {
  return new Promise(resolve => setTimeout(resolve, ms))
}
